<template>
  <a-form>
    <!-- <a-form-item label="来源">
      <a-input v-model="detail.sourceId"></a-input>
    </a-form-item> -->
    <a-form-item label="名称">
      <a-input v-model="detail.name"></a-input>
    </a-form-item>
    <a-form-item label="作者">
      <a-input v-model="detail.author"></a-input>
    </a-form-item>
       <a-form-item label="分类">
      <a-input v-model="detail.kind"></a-input>
    </a-form-item>
    <a-form-item label="封面">
      <a-input v-model="detail.coverUrl"></a-input>
    </a-form-item>
    <a-form-item>
      <a-button type="primary" @click="submit">更新</a-button>
    </a-form-item>
  </a-form>
</template>

<script>
import { getNovel, updateNovelSource } from '@/api'
export default {
  props: {
    id: {
      type: String
    }
  },
  data () {
    return {
      detail: {}
    }
  },
  created () {
    this.getDetail()
  },
  methods: {
    getDetail () {
      getNovel({ _id: this.id }).then(res => {
        console.log(this)
        if (res.code === 200) {
          this.detail = res.data
        }
      })
    },
    submit () {
      // if (!this.detail.sourceId) {
      //   this.$message.error('请输入来源ID！')
      //   return
      // }
      updateNovelSource(this.detail).then(res => {
        if (res.code === 200) {
          this.$router.push('/novel/' + this.id)
        }
      })
    }
  }
}
</script>

<style>

</style>